Feature/add pydantic models for 3d api#27
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the SolarFarmer SDK’s Pydantic model layer to cover additional 3D API payload structures (geometry, terrain, trackers/racks, and 3D inverter wiring) that were previously not represented under PVPlant / energy calculation inputs.
Changes:
- Add new 3D geometry and scene models (vectors/quads, racks/trackers, shading objects, and simple terrain DTOs).
- Add 3D inverter wiring models (
InverterInput,ModuleString,ModuleIndexRange) and updateInverter/PVPlantto reference them. - Add composition/serialization tests validating camelCase +
...IDalias behavior for 3D payloads.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_models/test_composition.py | Adds serialization + JSON round-trip coverage for new 3D models and PVPlant composition. |
| solarfarmer/models/vector3double.py | Introduces a 3D vector/point model used across 3D geometry DTOs. |
| solarfarmer/models/quad_double.py | Adds a 4-point quad model for rack geometry. |
| solarfarmer/models/rack.py | Adds 3D fixed-tilt rack model with mountingTypeID aliasing. |
| solarfarmer/models/racks.py | Adds a wrapper collection model for racks. |
| solarfarmer/models/tracker.py | Adds 3D tracker model with explicit ...ID aliases. |
| solarfarmer/models/trackers.py | Adds a wrapper collection model for trackers. |
| solarfarmer/models/indexed_object3d.py | Adds indexed mesh representation for 3D shading obstacles. |
| solarfarmer/models/shading_objects.py | Adds a collection model for shading objects (see API-shape comment). |
| solarfarmer/models/terrain_row_start_end_columns_dto.py | Adds DTO for active column spans in a terrain row. |
| solarfarmer/models/terrain_row_dto.py | Adds DTO for a terrain row made of column-span segments. |
| solarfarmer/models/mini_simple_terrain_dto.py | Adds DTO for terrain tiles (grid dimensions, vertices, row spans). |
| solarfarmer/models/simple_terrain.py | Adds container model for tiled “simple terrain” representation. |
| solarfarmer/models/module_index_range.py | Adds rack/tracker module indexing DTO with explicit mountingID alias. |
| solarfarmer/models/module_string.py | Adds module string DTO composed of module index ranges. |
| solarfarmer/models/inverter_input.py | Adds 3D inverter MPPT input wiring + losses + optimizer fields. |
| solarfarmer/models/inverter.py | Types inverter_inputs as list[InverterInput] for 3D wiring support. |
| solarfarmer/models/pv_plant.py | Extends PVPlant with 3D fields (racks/trackers/terrain/shading + specs dicts). |
| solarfarmer/models/enums.py | Adds PowerOptimizerOperationType enum for 3D optimizer configuration. |
| solarfarmer/models/init.py | Re-exports newly added models/enums for solarfarmer.models users. |
| solarfarmer/init.py | Re-exports newly added models/enums at top-level package API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove unnecessary info for docstring of dc_ohmic_connector_loss Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ss parameters are mutually exclusive (resistance takes precedence).
…ub.com/dnv-opensource/solarfarmer-python-sdk into feature/add-pydantic-models-for-3d-api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding several data models related to 3D API calls that were not available in the PV plant object of the energy calculation inputs